\(\int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx\) [700]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 41, antiderivative size = 99 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=-\frac {a^3 (i A+B) (1+i \tan (e+f x))^3}{8 c^4 f (1-i \tan (e+f x))^4}-\frac {a^3 (i A-7 B) (1+i \tan (e+f x))^3}{48 c^4 f (1-i \tan (e+f x))^3} \]

[Out]

-1/8*a^3*(I*A+B)*(1+I*tan(f*x+e))^3/c^4/f/(1-I*tan(f*x+e))^4-1/48*a^3*(I*A-7*B)*(1+I*tan(f*x+e))^3/c^4/f/(1-I*
tan(f*x+e))^3

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.073, Rules used = {3669, 79, 37} \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=-\frac {a^3 (-7 B+i A) (1+i \tan (e+f x))^3}{48 c^4 f (1-i \tan (e+f x))^3}-\frac {a^3 (B+i A) (1+i \tan (e+f x))^3}{8 c^4 f (1-i \tan (e+f x))^4} \]

[In]

Int[((a + I*a*Tan[e + f*x])^3*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^4,x]

[Out]

-1/8*(a^3*(I*A + B)*(1 + I*Tan[e + f*x])^3)/(c^4*f*(1 - I*Tan[e + f*x])^4) - (a^3*(I*A - 7*B)*(1 + I*Tan[e + f
*x])^3)/(48*c^4*f*(1 - I*Tan[e + f*x])^3)

Rule 37

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^(n +
1)/((b*c - a*d)*(m + 1))), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[m + n + 2, 0] && NeQ
[m, -1]

Rule 79

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(-(b*e - a*f
))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p + 1)*(c*f - d*e))), x] - Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1
) + c*f*(p + 1)))/(f*(p + 1)*(c*f - d*e)), Int[(c + d*x)^n*(e + f*x)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e,
f, n}, x] && LtQ[p, -1] && ( !LtQ[n, -1] || IntegerQ[p] ||  !(IntegerQ[n] ||  !(EqQ[e, 0] ||  !(EqQ[c, 0] || L
tQ[p, n]))))

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int \frac {(a+i a x)^2 (A+B x)}{(c-i c x)^5} \, dx,x,\tan (e+f x)\right )}{f} \\ & = -\frac {a^3 (i A+B) (1+i \tan (e+f x))^3}{8 c^4 f (1-i \tan (e+f x))^4}+\frac {(a (A+7 i B)) \text {Subst}\left (\int \frac {(a+i a x)^2}{(c-i c x)^4} \, dx,x,\tan (e+f x)\right )}{8 f} \\ & = -\frac {a^3 (i A+B) (1+i \tan (e+f x))^3}{8 c^4 f (1-i \tan (e+f x))^4}-\frac {a^3 (i A-7 B) (1+i \tan (e+f x))^3}{48 c^4 f (1-i \tan (e+f x))^3} \\ \end{align*}

Mathematica [A] (verified)

Time = 3.53 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.80 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=\frac {a^3 \left (-i A+B+2 (A-2 i B) \tan (e+f x)+3 i (A+i B) \tan ^2(e+f x)+6 i B \tan ^3(e+f x)\right )}{6 c^4 f (i+\tan (e+f x))^4} \]

[In]

Integrate[((a + I*a*Tan[e + f*x])^3*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^4,x]

[Out]

(a^3*((-I)*A + B + 2*(A - (2*I)*B)*Tan[e + f*x] + (3*I)*(A + I*B)*Tan[e + f*x]^2 + (6*I)*B*Tan[e + f*x]^3))/(6
*c^4*f*(I + Tan[e + f*x])^4)

Maple [A] (verified)

Time = 0.24 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.89

method result size
risch \(-\frac {a^{3} {\mathrm e}^{8 i \left (f x +e \right )} B}{16 c^{4} f}-\frac {i a^{3} {\mathrm e}^{8 i \left (f x +e \right )} A}{16 c^{4} f}+\frac {a^{3} {\mathrm e}^{6 i \left (f x +e \right )} B}{12 c^{4} f}-\frac {i a^{3} {\mathrm e}^{6 i \left (f x +e \right )} A}{12 c^{4} f}\) \(88\)
derivativedivides \(\frac {a^{3} \left (\frac {i B}{i+\tan \left (f x +e \right )}-\frac {4 i A +4 B}{4 \left (i+\tan \left (f x +e \right )\right )^{4}}-\frac {-i A -5 B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}-\frac {8 i B -4 A}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{4}}\) \(90\)
default \(\frac {a^{3} \left (\frac {i B}{i+\tan \left (f x +e \right )}-\frac {4 i A +4 B}{4 \left (i+\tan \left (f x +e \right )\right )^{4}}-\frac {-i A -5 B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}-\frac {8 i B -4 A}{3 \left (i+\tan \left (f x +e \right )\right )^{3}}\right )}{f \,c^{4}}\) \(90\)
norman \(\frac {\frac {a^{3} A \tan \left (f x +e \right )}{f c}+\frac {i B \,a^{3} \tan \left (f x +e \right )^{7}}{c f}+\frac {-i A \,a^{3}+B \,a^{3}}{6 c f}+\frac {\left (i A \,a^{3}+7 B \,a^{3}\right ) \tan \left (f x +e \right )^{6}}{2 c f}+\frac {\left (17 i A \,a^{3}+7 B \,a^{3}\right ) \tan \left (f x +e \right )^{2}}{6 c f}+\frac {7 \left (-2 i B \,a^{3}+a^{3} A \right ) \tan \left (f x +e \right )^{5}}{3 c f}-\frac {7 \left (-i B \,a^{3}+2 a^{3} A \right ) \tan \left (f x +e \right )^{3}}{3 c f}-\frac {\left (9 i A \,a^{3}+7 B \,a^{3}\right ) \tan \left (f x +e \right )^{4}}{2 c f}}{\left (1+\tan \left (f x +e \right )^{2}\right )^{4} c^{3}}\) \(226\)

[In]

int((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^4,x,method=_RETURNVERBOSE)

[Out]

-1/16*a^3/c^4/f*exp(8*I*(f*x+e))*B-1/16*I*a^3/c^4/f*exp(8*I*(f*x+e))*A+1/12*a^3/c^4/f*exp(6*I*(f*x+e))*B-1/12*
I*a^3/c^4/f*exp(6*I*(f*x+e))*A

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 49, normalized size of antiderivative = 0.49 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=-\frac {3 \, {\left (i \, A + B\right )} a^{3} e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, {\left (i \, A - B\right )} a^{3} e^{\left (6 i \, f x + 6 i \, e\right )}}{48 \, c^{4} f} \]

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^4,x, algorithm="fricas")

[Out]

-1/48*(3*(I*A + B)*a^3*e^(8*I*f*x + 8*I*e) + 4*(I*A - B)*a^3*e^(6*I*f*x + 6*I*e))/(c^4*f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (80) = 160\).

Time = 0.37 (sec) , antiderivative size = 167, normalized size of antiderivative = 1.69 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=\begin {cases} \frac {\left (- 16 i A a^{3} c^{4} f e^{6 i e} + 16 B a^{3} c^{4} f e^{6 i e}\right ) e^{6 i f x} + \left (- 12 i A a^{3} c^{4} f e^{8 i e} - 12 B a^{3} c^{4} f e^{8 i e}\right ) e^{8 i f x}}{192 c^{8} f^{2}} & \text {for}\: c^{8} f^{2} \neq 0 \\\frac {x \left (A a^{3} e^{8 i e} + A a^{3} e^{6 i e} - i B a^{3} e^{8 i e} + i B a^{3} e^{6 i e}\right )}{2 c^{4}} & \text {otherwise} \end {cases} \]

[In]

integrate((a+I*a*tan(f*x+e))**3*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**4,x)

[Out]

Piecewise((((-16*I*A*a**3*c**4*f*exp(6*I*e) + 16*B*a**3*c**4*f*exp(6*I*e))*exp(6*I*f*x) + (-12*I*A*a**3*c**4*f
*exp(8*I*e) - 12*B*a**3*c**4*f*exp(8*I*e))*exp(8*I*f*x))/(192*c**8*f**2), Ne(c**8*f**2, 0)), (x*(A*a**3*exp(8*
I*e) + A*a**3*exp(6*I*e) - I*B*a**3*exp(8*I*e) + I*B*a**3*exp(6*I*e))/(2*c**4), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^4,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 224 vs. \(2 (83) = 166\).

Time = 1.03 (sec) , antiderivative size = 224, normalized size of antiderivative = 2.26 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=-\frac {2 \, {\left (3 \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{7} + 3 i \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{6} - 3 \, B a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{6} - 17 \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 4 i \, B a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 10 i \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 10 \, B a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 17 \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 4 i \, B a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 3 i \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 3 \, B a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 3 \, A a^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{3 \, c^{4} f {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{8}} \]

[In]

integrate((a+I*a*tan(f*x+e))^3*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^4,x, algorithm="giac")

[Out]

-2/3*(3*A*a^3*tan(1/2*f*x + 1/2*e)^7 + 3*I*A*a^3*tan(1/2*f*x + 1/2*e)^6 - 3*B*a^3*tan(1/2*f*x + 1/2*e)^6 - 17*
A*a^3*tan(1/2*f*x + 1/2*e)^5 + 4*I*B*a^3*tan(1/2*f*x + 1/2*e)^5 - 10*I*A*a^3*tan(1/2*f*x + 1/2*e)^4 + 10*B*a^3
*tan(1/2*f*x + 1/2*e)^4 + 17*A*a^3*tan(1/2*f*x + 1/2*e)^3 - 4*I*B*a^3*tan(1/2*f*x + 1/2*e)^3 + 3*I*A*a^3*tan(1
/2*f*x + 1/2*e)^2 - 3*B*a^3*tan(1/2*f*x + 1/2*e)^2 - 3*A*a^3*tan(1/2*f*x + 1/2*e))/(c^4*f*(tan(1/2*f*x + 1/2*e
) + I)^8)

Mupad [B] (verification not implemented)

Time = 8.70 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.19 \[ \int \frac {(a+i a \tan (e+f x))^3 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^4} \, dx=\frac {-\frac {a^3\,\left (-B+A\,1{}\mathrm {i}\right )}{6}+\frac {a^3\,\mathrm {tan}\left (e+f\,x\right )\,\left (2\,A-B\,4{}\mathrm {i}\right )}{6}+B\,a^3\,{\mathrm {tan}\left (e+f\,x\right )}^3\,1{}\mathrm {i}+\frac {a^3\,{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (-3\,B+A\,3{}\mathrm {i}\right )}{6}}{c^4\,f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^4+{\mathrm {tan}\left (e+f\,x\right )}^3\,4{}\mathrm {i}-6\,{\mathrm {tan}\left (e+f\,x\right )}^2-\mathrm {tan}\left (e+f\,x\right )\,4{}\mathrm {i}+1\right )} \]

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^3)/(c - c*tan(e + f*x)*1i)^4,x)

[Out]

((a^3*tan(e + f*x)*(2*A - B*4i))/6 - (a^3*(A*1i - B))/6 + B*a^3*tan(e + f*x)^3*1i + (a^3*tan(e + f*x)^2*(A*3i
- 3*B))/6)/(c^4*f*(tan(e + f*x)^3*4i - 6*tan(e + f*x)^2 - tan(e + f*x)*4i + tan(e + f*x)^4 + 1))